#ifndef _SOME_MEGA_DIRECTION_DEFINE_H_
#define _SOME_MEGA_DIRECTION_DEFINE_H_

#include <assert.h>

#include "point.h"

namespace Samsung
{
	enum Direction
	{
		UP = 0,
		LEFT,
		DOWN,
		RIGHT
	};
	Direction GetNextDirection(Direction current, char turnTo)
	{
		switch (current)
		{
		case UP:
			switch (turnTo)
			{
			case 'l':
			case 'L':
				return LEFT;
			case 'r':
			case 'R':
				return RIGHT;
			default:
				assert(false);
			}
			break;
		case LEFT:
			switch (turnTo)
			{
			case 'l':
			case 'L':
				return DOWN;
			case 'r':
			case 'R':
				return UP;
			default:
				assert(false);
			}
			break;
		case DOWN:
			switch (turnTo)
			{
			case 'l':
			case 'L':
				return RIGHT;
			case 'r':
			case 'R':
				return LEFT;
			default:
				assert(false);
			}
			break;

		case RIGHT:
			switch (turnTo)
			{
			case 'l':
			case 'L':
				return UP;
			case 'r':
			case 'R':
				return DOWN;
			default:
				assert(false);
			}
			break;
		}
	}

	Point GetDeltha(const Direction& d)
	{
		switch (d)
		{
		case UP:
			return Point(0, 1);
		case DOWN:
			return Point(0, -1);
		case LEFT:
			return Point(-1, 0);
		case RIGHT:
			return Point(1, 0);
		default:
			assert(false);
		}
	}
	
}

#endif //_SOME_MEGA_DIRECTION_DEFINE_H_